package drds.global_transaction.resource_manager.proxy.datasource;

import java.io.PrintWriter;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

import javax.sql.DataSource;

import com.alibaba.druid.pool.DruidDataSource;

public abstract class AbstractDataSourceProxy implements DataSource
{

	protected DruidDataSource druidDataSource;

	public AbstractDataSourceProxy(DruidDataSource druidDataSource)
	{
		this.druidDataSource = druidDataSource;
	}

	public DruidDataSource getDruidDataSource()
	{
		return druidDataSource;
	}

	@Override
	public <T> T unwrap(Class<T> iface) throws SQLException
	{
		return druidDataSource.unwrap(iface);
	}

	@Override
	public boolean isWrapperFor(Class<?> iface) throws SQLException
	{
		return druidDataSource.isWrapperFor(iface);
	}

	@Override
	public PrintWriter getLogWriter() throws SQLException
	{
		return druidDataSource.getLogWriter();
	}

	@Override
	public void setLogWriter(PrintWriter out) throws SQLException
	{
		druidDataSource.setLogWriter(out);
	}

	@Override
	public int getLoginTimeout() throws SQLException
	{
		return druidDataSource.getLoginTimeout();
	}

	@Override
	public void setLoginTimeout(int seconds) throws SQLException
	{
		druidDataSource.setLoginTimeout(seconds);
	}

	@Override
	public Logger getParentLogger() throws SQLFeatureNotSupportedException
	{
		return druidDataSource.getParentLogger();
	}
}
